package cn.chenhuanming.shh.administer.entity.jpa;

import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Article entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "article", catalog = "house")
public class Article implements java.io.Serializable {

	// Fields

	private Integer id;
	private UserSystem userSystem;
	private String title;
	private String content;
	private String photo;
	private LocalDateTime releaseTime;
	private String status;

	// Constructors

	/** default constructor */
	public Article() {
	}

	/** minimal constructor */
	public Article(UserSystem userSystem, String title, String content,
			LocalDateTime releaseTime, String status) {
		this.userSystem = userSystem;
		this.title = title;
		this.content = content;
		this.releaseTime = releaseTime;
		this.status = status;
	}

	/** full constructor */
	public Article(UserSystem userSystem, String title, String content,
			String photo, LocalDateTime releaseTime, String status) {
		this.userSystem = userSystem;
		this.title = title;
		this.content = content;
		this.photo = photo;
		this.releaseTime = releaseTime;
		this.status = status;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "publisher", nullable = false)
	public UserSystem getUserSystem() {
		return this.userSystem;
	}

	public void setUserSystem(UserSystem userSystem) {
		this.userSystem = userSystem;
	}

	@Column(name = "title", nullable = false, length = 100)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "content", nullable = false, length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "photo")
	public String getPhoto() {
		return this.photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	@Column(name = "release_time", nullable = false, length = 19)
	public LocalDateTime getReleaseTime() {
		return this.releaseTime;
	}

	public void setReleaseTime(LocalDateTime releaseTime) {
		this.releaseTime = releaseTime;
	}

	@Column(name = "status", nullable = false, length = 3)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}